home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- #
- # Graph.h
- #
- # Copyright © 1989-90 Apple Computer, Inc.
- # All rights reserved.
- #
- # The includes for the Graph library.
- #
- -------------------------------------------------------------------------------*/
-
- /* These are the kinds of graphs that our library supports, although only the
- bar graph is implemented for this example. */
- typedef enum {kBar, kStackedBar, kPie, kLine} GraphType;
-
- #define kMaxPoints 20 /* maximum number of points we support */
- #define kMargin 10 /* the left/right margin of each bar in bar graph */
-
- typedef struct {
- short whichOne; /* the index of this point */
- long value; /* the value of this point */
- short top; /* the graphics rectangle of this point */
- short left;
- short bottom;
- short right;
- } GraphValue, *GraphValuePtr;
-
- typedef GraphValue GData[kMaxPoints-1]; /* array of graph points, 0-based! */
-
- typedef struct {
- GraphType thisGraph; /* type of graph it is */
- short numPoints; /* number of points in this graph */
- short top;
- short left;
- short bottom;
- short right; /* the graph’s rectangle with respect
- to which our graph is computed */
- short graphYMax; /* the graph's maximum Y coord value */
- short graphYMin; /* the graph's minimum Y coord value */
- /* use these to scale the graph. */
- GData graphItems; /* the data points in the graph */
- } GraphStruct, *GraphStructPtr;
-
- /* the function prototypes */
- #ifdef __cplusplus
- extern "C" {
- #endif
- GraphStructPtr DoGraphInit( GraphType whichGraphType );
- void DoGraphSetGraphRect( short top, short left, short bottom, short right, GraphStructPtr graphStorage );
- void DoGraphSetPoint( short which, long value, GraphStructPtr graphStorage );
- short DoGraphGetNumPoints( GraphStructPtr graphStorage );
- void DoGraphComputeBars( GraphStructPtr graphStorage );
- short DoGraphGetYMax( GraphStructPtr graphStorage );
- short DoGraphGetYMin( GraphStructPtr graphStorage );
- short DoGraphGetBar( short which, short *top, short *left, short *bottom, short *right,
- GraphStructPtr graphStorage );
- GraphStructPtr DoGraphDispose( GraphStructPtr graphStorage );
- #ifdef __cplusplus
- }
- #endif
-